//: Playground - noun: a place where people can play

import UIKit

var str = "Hello, playground"


let string = "asdfghjkl"

str = "abc"


//NSString *string2 = @"sdfghjkl";
//[string2 setString:@"abc"];
for c in str.characters{
print(c)
}
//"a"+"b"+"c"+num+"d"
let string3 = str+string

//简单字符串的拼接
let hour = 2
let min = 5
let sec = 5

let time = "\(hour):\(min):\(sec)"
//格式化拼接
let time2 = String(format:"%02d:%02d:%02d",arguments:[hour,min,sec])
print(time2)


//截取
//一般我们会把String转化为NSString进行操作


let baidu = "www.baidu.com"
//let header = baidu.substringToIndex(Index:index)
let header = (baidu as NSString).substringToIndex(3)
let body = (baidu as NSString).substringWithRange(NSMakeRange(4, 5))
let footer = (baidu as NSString).substringFromIndex(10)





//print(str.characters.count)




